const express = require("express");

const router = express.Router();

// get接口
router.get("/get", (req, res) => {
  const query = req.query;

  res.send({
    status: 0,
    msg: "GET 请求成功",
    data: query,
  });
});
// post接口
router.post("/post", (req, res) => {
  // 通过req.body获取请求体中包括的url-encoded格式的数据
  const body = req.body;
  res.send({
    status: 0,
    msg: "POST 请求成功",
    data: body,
  });
});

module.exports = router;
